/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Vue;

import java.awt.Dimension;
import java.awt.Font;
import static java.awt.image.ImageObserver.WIDTH;
import java.io.File;
import java.util.TreeSet;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

/**
 *
 * @author Gloire
 */
@SuppressWarnings("serial")
public class Resultat extends JPanel{
    
    private TreeSet<String> trouves;
    private JLabel find;
    private JScrollPane mine;
    
    public Resultat(TreeSet<String> solutions){
        trouves = solutions;
        String str = "";
        Font font = null;
        try{
            font = Font.createFont(Font.TRUETYPE_FONT,
				    new File("./src/images/font.ttf")).deriveFont(
			       	    Font.BOLD, 13f);
            setFont(font);
        }catch(Exception e){
            System.out.println("fichier non trouvée");
        }
        
        find = new JLabel("<html>Solution :</html>");
        find.setFont(font);
        find.setVerticalAlignment(WIDTH);
        
        
        mine = new JScrollPane(find);
        mine.setPreferredSize(new Dimension(500,480));
        mine.setBorder(null);
        //scroll avec souris
        mine.setWheelScrollingEnabled(true);
        mine.setOpaque(false);
        mine.getViewport().setOpaque(false);
        add(mine);
        setFind();
    }
    
    public void setFind(){
        String debut = "<html> Solutions : <br><table>";
        String fin = "</table></html>";
        String str = "";
        for(String mot : trouves){
            str += mot;
            str += "<br>";
        }
        find.setText(debut+str+fin);
    }
}
